package first.spring.community.controller;

<<<<<<< HEAD
import first.spring.community.dto.CommentCreateDTO;
import first.spring.community.dto.CommentDTO;
import first.spring.community.dto.QuestionDTO;
import first.spring.community.service.CommentService;
=======
import first.spring.community.dto.QuestionDTO;
import first.spring.community.mapper.QuestionMapper;
import first.spring.community.model.Question;
>>>>>>> a0fc79d505bdb077dabd50bf32f5cc01c09d40f2
import first.spring.community.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

<<<<<<< HEAD
import java.util.List;

=======
>>>>>>> a0fc79d505bdb077dabd50bf32f5cc01c09d40f2
@Controller
public class QuestionController {

    @Autowired
<<<<<<< HEAD
    private CommentService commentService;
    @Autowired
    private QuestionService questionService;

    @GetMapping("/question/{id}")
    public String question(@PathVariable(name = "id") Long id,
                           Model model) {
        QuestionDTO questionDTO = questionService.getById(id);
        questionService.incView(id);
        List<CommentDTO> comments = commentService.listByQustionId(id);
        //累加阅读数功能
        model.addAttribute("question", questionDTO);
        model.addAttribute("comment", questionDTO);
=======
    private QuestionService questionService;

    @GetMapping("/question/{id}")
    public String question(@PathVariable(name="id") Integer id,
    Model model){
        QuestionDTO questionDTO =questionService.getById(id);
        model.addAttribute("question",questionDTO);
>>>>>>> a0fc79d505bdb077dabd50bf32f5cc01c09d40f2
        return "question";
    }
}
